package com.xuanwei.web.controller;

import com.xuanwei.core.response.ResultVO;
import com.xuanwei.core.util.FastDFSClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @Author jiangyong
 * @Description TODO
 * @Date 2019/9/2 10:25
 **/
@RestController
@RequestMapping("/wx")
public class UploadController {


    @Autowired
    private FastDFSClient fastDFSClient;

    @RequestMapping(value = "upload", method = RequestMethod.POST)
    public ResultVO upload(MultipartFile file) throws IOException {
        String s = fastDFSClient.uploadImage(file);
        return ResultVO.successResult("上传成功", s);
    }
}
